package view.components.tab
{
	//import utils.TextTool;
	import flash.utils.getDefinitionByName
	
	public class TabBar2 extends TabBar
	{
		private var Resource:*;
		private var TextTool:*;
		
		public function TabBar2(id:int, text:String, width:int)
		{
			initClass();
			super(id, text, width);
			
		}
		
		private function initClass():void
		{
			Resource = getDefinitionByName("global.Resource");
			TextTool = getDefinitionByName("utils.TextTool");
		}
		
		override protected function initBg() : void
		{
			bgOn = Resource.getShape("butBg");
			bgOff = Resource.getShape("butBg4");
			
			bgOn.width = tabWidth;
			bgOff.width = tabWidth;
			
			bgOn.height = 22;
			bgOff.height = 20;
			
			addChild(bgOff);
			addChild(bgOn);
			
		}
		
		override protected function initFaceText(text:String):void
		{
			faceText = TextTool.getTextField(this.tabWidth,20,12,0xFFFFFF,false,true,"center");
			
			faceText.y = (this.height - 20) * .5; 
			faceText.text = text;
			addChild(faceText);
		}
		
		override public function switchOnOff(v:Boolean):void
		{
			if (v)
			{
				bgOn.visible = true;
				bgOff.visible = false;
				faceText.textColor = 0xFFFFFF;
			}
			else
			{
				bgOn.visible = false;
				bgOff.visible = true;
				faceText.textColor = 0x0;
			}
			this.mouseEnabled = !v;
		}
	}
}